<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <button @click="fn">点我啊</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      const obj = new Vue({
        el: '#app',
        data() {
            return {
                msg: '你好'
            }
        },
        methods: {
          fn () {
            // 当前Vue实例
            console.log(this)
            console.log(this === obj) // true

            // 在Vue实例创建的某个阶段，会自动把data中的所有属性
            // methods中的所有方法全部挂在到实例的最外层
            // 所以我要用就直接this.xxx访问
            console.log(this.msg)
          }
        }
      })
    </script>
  </body>
</html>
